package com.fanyouzhao.ehome.entity;

import com.alibaba.fastjson.annotation.JSONField;

import java.io.Serializable;
import java.util.Date;

/**
 * @Author: fanyouzhao
 * @Date: 15:34 2021/4/23
 */
public class User implements Serializable {
    private Integer id;
    private String name;
    private String phone;
//    @JSONField(format = "YYYY-MM-dd")
/*    这里要特别注意，当使用JSON.parseObject()方法自JSON字符串转JAVA对象时（带日期的）
    ，如果日期字段做了格式化注解，那么转换后的JAVA对象的日期字段会变成其他的时间。*/
    private Date birth;
    private String sex;
    @JSONField(format = "YYYY-MM-dd HH:mm:ss")
    private Date regTime;

    public User() {
    }

    public User(Integer id, String name, String phone, Date birth, String sex, Date regTime) {
        this.id = id;
        this.name = name;
        this.phone = phone;
        this.birth = birth;
        this.sex = sex;
        this.regTime = regTime;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", phone='" + phone + '\'' +
                ", birth=" + birth +
                ", sex='" + sex + '\'' +
                ", regTime=" + regTime +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getPhone() {
        return phone;
    }

    public Date getBirth() {
        return birth;
    }

    public String getSex() {
        return sex;
    }

    public Date getRegTime() {
        return regTime;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public void setBirth(Date birth) {
        this.birth = birth;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public void setRegTime(Date regTime) {
        this.regTime = regTime;
    }
}